package com.idanchuang.component.redis;

import com.idanchuang.component.redis.task.TimeTaskManager;
import com.idanchuang.component.redis.task.TimedTask;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.List;

/**
 * @author yjy
 * @date 2019/11/27 11:09
 **/
@Configuration
public class ComponentRedisTimedTaskAutoConfiguration {

    @Bean
    @ConditionalOnMissingBean(TimeTaskManager.class)
    public TimeTaskManager redisTimeTaskManager(List<TimedTask> tasks) {
        return new TimeTaskManager(tasks);
    }

}
